| Conditions | 1 |
| Paths | 1 |
| Total Lines | 42 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | /* global browser, chrome */ |
||
| 17 | get: function(key) { |
||
| 18 | return new C_Promise(function(){ |
||
| 19 | if (API.promise) { |
||
| 20 | localStorage.get(key).then((function(item){ |
||
| 21 | /* jshint ignore:start */ |
||
| 22 | if (typeof key === "[object Array]") { |
||
| 23 | this.call_then(item); |
||
| 24 | } |
||
| 25 | |||
| 26 | else { |
||
| 27 | if (item[key] === undefined) { |
||
| 28 | this.call_error("Data not found"); |
||
| 29 | } |
||
| 30 | else { |
||
| 31 | this.call_then(item[key]); |
||
| 32 | } |
||
| 33 | } |
||
| 34 | /* jshint ignore:end */ |
||
| 35 | }).bind(this), (function(error){ |
||
| 36 | this.call_error(error); |
||
| 37 | }).bind(this)); |
||
| 38 | } |
||
| 39 | else{ |
||
| 40 | localStorage.get(key, (function(item){ |
||
| 41 | /* jshint ignore:start */ |
||
| 42 | if (typeof key === "[object Array]") { |
||
| 43 | this.call_then(item); |
||
| 44 | } |
||
| 45 | |||
| 46 | else { |
||
| 47 | if (item[key] === undefined) { |
||
| 48 | this.call_error("Data not found"); |
||
| 49 | } |
||
| 50 | else { |
||
| 51 | this.call_then(item[key]); |
||
| 52 | } |
||
| 53 | } |
||
| 54 | /* jshint ignore:end */ |
||
| 55 | }).bind(this)); |
||
| 56 | } |
||
| 57 | }); |
||
| 58 | }, |
||
| 59 | |||
| 77 | }; |